<template>
  <div id="login-top">
    <div id="ms-login">
      <!--标题-->
      <div id="ms-title">贷款后台管理系统</div>
      <!--用户名-->
      <el-form
        :model="param"
        :rules="rules"
        ref="login"
        label-width="0px"
        id="ms-content"
      >
        <el-form-item prop="password">
          <el-input v-model="param.username" placeholder="username">
            <el-button slot="prepend" icon="el-icon-lx-people"></el-button>
          </el-input>
        </el-form-item>
        <!--密码-->
        <el-form-item prop="password">
          <el-input
            type="password"
            placeholder="password"
            v-model="param.password"
            @keyup.enter.native="submitForm()"
          >
            <el-button slot="prepend" icon="el-icon-lx-lock"></el-button>
          </el-input>
        </el-form-item>
        <!--登录-->
        <div id="login-btn">
          <el-button type="primary" @click="submitForm()">登录</el-button>
        </div>
        <!--备注-->
        <p id="login-tips">祝你贷款愉快</p>
      </el-form>
    </div>
    <div class="cube">
      <!-- 外层立方体 -->
      <div class="outer-cube">
        <div class="outer-top">
          <img src="../assets/red.jpg" />
        </div>
        <div class="outer-bottom">
          <img src="../assets/blue.jpg" />
        </div>
        <div class="outer-front">
          <img src="../assets/block.jpg" />
        </div>
        <div class="outer-back">
          <img src="../assets/white.jpg" />
        </div>
        <div class="outer-left">
          <img src="../assets/yellow.jpg" />
        </div>
        <div class="outer-right">
          <img src="../assets/7.jpg" />
        </div>
      </div>
      <!-- 内层立方体 -->
      <div class="inner-cube">
        <div class="inner-top">
          <img src="../assets/8.jpg" />
        </div>
        <div class="inner-bottom">
          <img src="../assets/red.jpg" />
        </div>
        <div class="inner-front">
          <img src="../assets/blue.jpg" />
        </div>
        <div class="inner-back">
          <img src="../assets/block.jpg" />
        </div>
        <div class="inner-left">
          <img src="../assets/yellow.jpg" />
        </div>
        <div class="inner-right">
          <img src="../assets/7.jpg" />
        </div>
      </div>
    </div>

    <!-- 模态框 -->
<div>
        <el-dialog  :title="title" :visible.sync="dialogFormVisible" @close="closeDialog">
        
        </el-dialog>
</div>




  </div>
</template>

<script>
export default {
  data: function () {
    return {
      loading:"false",
      param: {
        username: "",
        password: "",
      },
      dialogFormVisible: false,
      title: "",
      rules: {
        username: [
          { required: true, message: "请输入用户名", trigger: "blur" },
        ],
        password: [{ required: true, message: "请输入密码", trigger: "blur" }],
      },
       computed:{
    // showUsername() {
    //   return window.sessionStorage.getItem("username");
    // }
  },
    };
  },
  methods: {
    submitForm() {
    
      this.$axios.post("http://localhost:8601/auth/login", this.param).then((resp) => {
         console.log(resp.data.code);
            if(resp.data.code==200){
              console.log(this.dialogFormVisible),
               
              (this.dialogFormVisible = true),
              (this.title = "登录成功"),
              (this.$router.push('/main'));
            }else if(resp.data.code==500){
              this.$message("用户名密码错误");
              //  (this.dialogFormVisible = true),
              //  (this.title = "用户名密码错误")
            }else if(resp.data.code==300){
              this.$message("无此用户");
              //  (this.dialogFormVisible = true),
              //  (this.title = "无此用户")
            }
        });
    }
  }
}
</script>

<style>
#login-top {
  position: relative;
  width: 100%;
  height: 700px;
  /* background-color: aqua; */
  background-image: url(../assets/8.jpg);
  background-size: 100%;
}
#ms-title {
  width: 100%;
  line-height: 50px;
  text-align: center;
  font-size: 20px;
  color: rgb(7, 7, 7);
  border-bottom: 1px solid #ddd;
}
#ms-login {
  position: absolute;
  left: 50%;
  top: 350px;
  width: 350px;
  margin: -190px 0 0 -175px;
  border-radius: 5px;
  background: rgba(255, 255, 255, 0.3);
  overflow: hidden;
}
#ms-content {
  padding: 30px 30px;
}
#login-btn {
  text-align: center;
}
#login-btn button {
  width: 100%;
  height: 36px;
  margin-bottom: 10px;
}
#login-tips {
  font-size: 12px;
  line-height: 30px;
  color: rgb(8, 8, 8);
}
/* //立方体 */
.cube {
  position: relative;
  top: 20%;
  margin: 0px auto;
  /* margin-top: 9%; */
  margin-left: 75%;
  width: 200px;
  height: 200px;
  transform: rotateX(-30deg) rotateY(-80deg);
  transform-style: preserve-3d;
  animation: rotate 15s infinite;
}

.cube .outer-cube,
.cube .inner-cube {
  transform-style: preserve-3d;
}

/* 旋转立方体 */
@keyframes rotate {
  from {
    transform: rotateX(0deg) rotateY(0deg);
  }

  to {
    transform: rotateX(360deg) rotateY(360deg);
  }
}

/* 外层立方体样式 */
.outer-cube .outer-top,
.outer-cube .outer-bottom,
.outer-cube .outer-right,
.outer-cube .outer-left,
.outer-cube .outer-front,
.outer-cube .outer-back {
  position: absolute;
  top: 0;
  left: 0;
  width: 200px;
  height: 200px;
  border: 1px solid #fff;
  opacity: 0.3;
  transition: all 0.9s;
}

.outer-cube img {
  width: 200px;
  height: 200px;
}

.outer-top {
  transform: rotateX(90deg) translateZ(100px);
}

.outer-bottom {
  transform: rotateX(-90deg) translateZ(100px);
}

.outer-front {
  transform: rotateY(0deg) translateZ(100px);
}

.outer-back {
  transform: translateZ(-100px) rotateY(180deg);
}

.outer-left {
  transform: rotateY(90deg) translateZ(100px);
}

.outer-right {
  transform: rotateY(-90deg) translateZ(100px);
}

/* 嵌套的内层立方体样式 */
.inner-cube > div {
  position: absolute;
  top: 35px;
  left: 35px;
  width: 130px;
  height: 130px;
}

.inner-cube img {
  width: 130px;
  height: 130px;
}

.inner-top {
  transform: rotateX(90deg) translateZ(65px);
}

.inner-bottom {
  transform: rotateX(-90deg) translateZ(65px);
}

.inner-front {
  transform: rotateY(0deg) translateZ(65px);
}

.inner-back {
  transform: translateZ(-65px) rotateY(180deg);
}

.inner-left {
  transform: rotateY(90deg) translateZ(65px);
}

.inner-right {
  transform: rotateY(-90deg) translateZ(65px);
}

.cube:hover .outer-top {
  right: -70px;
  bottom: -70px;
  opacity: 0.8;
  transform: rotateX(90deg) translateZ(200px);
}

.cube:hover .outer-bottom {
  right: -70px;
  bottom: -70px;
  opacity: 0.8;
  transform: rotateX(-90deg) translateZ(200px);
}

.cube:hover .outer-front {
  right: -70px;
  bottom: -70px;
  opacity: 0.8;
  transform: rotateY(0deg) translateZ(200px);
}

.cube:hover .outer-back {
  right: -70px;
  bottom: -70px;
  opacity: 0.8;
  transform: translateZ(-200px) rotateY(180deg);
}

.cube:hover .outer-left {
  right: -70px;
  bottom: -70px;
  opacity: 0.8;
  transform: rotateY(90deg) translateZ(200px);
}

.cube:hover .outer-right {
  right: -70px;
  bottom: -70px;
  opacity: 0.8;
  transform: rotateY(-90deg) translateZ(200px);
}

.message .author {
  position: absolute;
  right: 50px;
  background-image: -webkit-linear-gradient(
    left,
    blue,
    #66ffff 10%,
    #cc00ff 20%,
    #cc00cc 30%,
    #ccccff 40%,
    #00ffff 50%,
    #ccccff 60%,
    #cc00cc 70%,
    #cc00ff 80%,
    #66ffff 90%,
    blue 100%
  );
  font-size: 35px;
  -webkit-text-fill-color: transparent;
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-background-size: 200% 100%;
  background-size: 200% 100%;
  -webkit-animation: masked-animation 4s linear infinite;
  animation: masked-animation 4s linear infinite;
}

@keyframes masked-animation {
  0% {
    background-position: 0 0;
  }

  100% {
    background-position: -100% 0;
  }
}

.message .tip {
  position: absolute;
  right: 0px;
  margin-top: 60px;
  color: red;
  font-size: 18px;
}
</style>